package com.zwj.enums;

import com.zwj.vo.EnumResult;

import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;

public enum TeacherPositionEnum {
    EXPERIMENTER("1","实验员"),LECTURER("2","讲师"),PROFESSOR("3","教授"),ASSOCIATE_PROFESSOR("4","副教授"),DIRECTOR("5","主任");
    private String key;
    private String value;
    TeacherPositionEnum(String key, String value) {
        this.key = key;
        this.value = value;
    }
    public static String getEnumValue(String key) {
        TeacherPositionEnum[] teacherPositionEnums = TeacherPositionEnum.values();
        for (TeacherPositionEnum teacherPositionEnum : teacherPositionEnums) {
            if (teacherPositionEnum.getKey().equals(key)) {
                return teacherPositionEnum.getValue();
            }
        }
        return null;
    }
    public static List<EnumResult> getEnumList() {
        TeacherPositionEnum[] teacherPositionEnums = TeacherPositionEnum.values();
        List<EnumResult> result = Stream.of(teacherPositionEnums).map(
                entry -> new EnumResult(entry.getKey(), entry.getValue())).collect(Collectors.toList());
        return result;
    }
    public String getKey() {
        return key;
    }

    public String getValue() {
        return value;
    }
}
